{extend name="base" /}
{block name="body"}
<div class="layui-card">
    <div class="layui-card-header">
        <form action="{:url('user/customer/index')}" class="layui-form" method="get">
            <div class="layui-form-item">
                <div class="layui-input-inline">
                    <input type="text" name="cname" value="{:input('cname')}" autocomplete="off" placeholder="请输入客户名称" class="layui-input"/>
                </div>
                <div class="layui-input-inline">
                    <select name="type">
                        <option value="">{:user_config_totitle('type','customer')}</option>
                        {foreach name=":parse_attr($type.options)" key="i" item="j"}
                        <option value="{$i}" {if condition="input('?type') and (input('type') eq $i)"} selected="selected"{/if}>{$j}</option>
                        {/foreach}
                    </select>
                </div>
                <div class="layui-input-inline">
                    <select name="intention">
                        <option value="">{:user_config_totitle('intention','customer')}</option>
                        {foreach name=":parse_attr($intention.options)" key="i" item="j"}
                        <option value="{$i}" {if condition="input('?intention') and (input('intention') eq $i)"} selected="selected"{/if}>{$j}</option>
                        {/foreach}
                    </select>
                </div>
                <div class="layui-input-inline">
                    <select name="come_from">
                        <option value="">{:user_config_totitle('come_from','customer')}</option>
                        {foreach name=":parse_attr($come_from.options)" key="i" item="j"}
                        <option value="{$i}" {if condition="input('?come_from') and (input('come_from') eq $i)"} selected="selected"{/if}>{$j}</option>
                        {/foreach}
                    </select>
                </div>
                <div class="layui-input-inline">
                    <select name="status">
                        <option value="">{:user_config_totitle('status','customer')}</option>
                        {foreach name=":parse_attr($status.options)" key="i" item="j"}
                        <option value="{$i}" {if condition="input('?status') and (input('status') eq $i)"} selected="selected"{/if}>{$j}</option>
                        {/foreach}
                    </select>
                </div>
                <div class="layui-input-inline">
                    <button class="layui-btn layui-btn-primary ajax-search"><i class="fa fa-search"></i></button>
                </div>
            </div>
        </form>
    </div>
    <div class="layui-card-body">
        <div class="layui-btn-group">
            <a href="{:url('user/customer/add',['type'=>'public'])}" class="layui-btn"><i class="fa fa-plus-circle"></i> 新增客户</a>
            <a href="{:url('user/customer/upload_excel')}" class="layui-btn layui-btn-primary"><i class="fa fa-file-excel-o"></i> 导入客户资料</a>
        </div>
		<table class="layui-table layui-form">
			<thead>
				<tr>
                                        <th>{:user_config_totitle('intention','customer')}</th>
					<th>客户名称</th>
					<th>手机号码</th>
					<th>区域</th>
					<th>地址</th>
					<th>{:user_config_totitle('type','customer')}</th>
                                        <th>{:user_config_totitle('come_from','customer')}</th>
					<th>创建时间</th>
					<th>{:user_config_totitle('status','customer')}</th>
					<th>操作</th>
				</tr>
			</thead>
			<tbody>
				{foreach name="list" item="v" empty="$empty"}
				<tr>
					<td>{:user_config_toval('intention',$v['intention'],'customer')}</td>
                                        <td>{$v.cname}</td>
					<td>{$v.mobile}</td>
                                        <td>{$v.province}/{$v.city}/{$v.area}</td>
                                        <td>{$v.address}</td>
                                        <td>{:user_config_toval('type',$v['type'],'customer')}</td>
                                        <td>{:user_config_toval('come_from',$v['come_from'],'customer')}</td>
					<td>{:time_trans($v['create_time'])}</td>
                                        <td>{:user_config_toval('status',$v['status'],'customer')}</td>
					<td>
                                            <a href="{:url('user/customer/get_cus', ['id' => $v.id])}" class="layui-btn layui-btn-xs layui-btn-normal ajax-action"><i class="fa fa-edit"></i> 占用客户</a>
                                            <a href="{:url('user/customer/del', ['id' => $v.id])}" class="layui-btn layui-btn-xs layui-btn-danger ajax-delete"><i class="fa fa-trash-o"></i> 删除</a>
					</td>
				</tr>
				{/foreach}
			</tbody>
		</table>
		<div class="page">{$list->render()}</div>
	</div>
</div>
{/block}